package com.easy.service.impl;

import com.easy.annotation.LogMethod;
import com.easy.bean.Top_Pattern;
import com.easy.mapper.Top_patternDao;
import com.easy.service.Top_PatternService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Top_PatternServiceImpl implements Top_PatternService {
    @Autowired
    Top_patternDao top_patternDao;

    @LogMethod(serviceName = "添加",recordParam = true,recordReturn = true)
    @Override
    public Top_Pattern add(Top_Pattern top_pattern) {
        top_patternDao.add(top_pattern);
        return top_patternDao.one(top_pattern.getId());

    }

    @LogMethod(serviceName = "删除",recordParam = true,recordReturn = true)
    @Override
    public int del(Integer id) {
        return top_patternDao.del(id);

    }

    @LogMethod(serviceName = "修改",recordParam = true,recordReturn = true)
    @Override
    public Top_Pattern edit(Top_Pattern top_pattern) {
        top_patternDao.edit(top_pattern);
        return top_patternDao.one(top_pattern.getId());
    }

    @LogMethod(serviceName = "查询",recordParam = true,recordReturn = true)
    @Override
    public Top_Pattern one(Integer id) {
        return top_patternDao.one(id);

    }

    @LogMethod(serviceName = "查询",recordParam = true,recordReturn = true)
    @Override
    public List<Top_Pattern> all(Top_Pattern top_pattern) {
        return top_patternDao.all(top_pattern);

    }

    @LogMethod(serviceName = "分页查询",recordParam = true,recordReturn = true)
    @Override
    public void page(Page page, Top_Pattern top_pattern) {
        int count =top_patternDao.pageCount(top_pattern);
        Object data=top_patternDao.page(page, top_pattern);
        page.setCount(count);
        page.setData(data);

    }

}
